package cn.tedu.review;

import java.math.BigDecimal;
import java.util.Scanner;

public class TestBigDecimal {
    public static void main(String[] args) {
        System.out.println("请输入要计算的第一个数");
        double a=new Scanner(System.in).nextDouble();
        System.out.println("请输入要计算的第二个数");
        double b=new Scanner(System.in).nextDouble();

        BigDecimal bd1=new BigDecimal(a+"");
        BigDecimal bd2=new BigDecimal(b+"");

        System.out.println(bd1.add(bd2));
        System.out.println(bd1.subtract(bd2));
        System.out.println(bd1.multiply(bd2));
        System.out.println(bd1.divide(bd2,3,BigDecimal.ROUND_HALF_UP));
    }
}
